package org.chengn.level_hard.context466;

/**
 * @Title: Context466
 * @Author ChengN
 * @Package org.chengn.level_hard.context466
 * @Date 2024/1/2 1:32
 * @description: 统计重复个数TLE
 */
public class Context466_TLE {
    public int getMaxRepetitions(String s1, int n1, String s2, int n2) {
        int idx1 = 0, idxn1 = 0, idx2 = 0, idxn2 = 0, res = 0;
        while (idxn1 < n1) {
            while (idx1 < s1.length()) {
                if (s1.charAt(idx1) == s2.charAt(idx2)) {
                    idx2++;
                    if (idx2 == s2.length()) {
                        idx2 = 0;
                        idxn2 ++;
                        if (idxn2 == n2) {
                            idxn2 = 0;
                            res++;
                        }
                    }
                }
                idx1++;
            }
            idx1 = 0;
            idxn1 ++;
        }

        return res;

    }
}
